AmCharts.AmPieChart=AmCharts.Class({inherits:AmCharts.AmSlicedChart,construct:function(){AmCharts.AmPieChart.base.construct.call(this);this.pieAlpha=1;this.pieBrightnessStep=30;this.minRadius=10;this.depth3D=0;this.startAngle=90;this.angle=this.innerRadius=0;this.startRadius="500%";this.pullOutRadius="20%";this.labelRadius=30;this.labelText="[[title]]: [[percents]]%";this.balloonText="[[title]]: [[percents]]% ([[value]])\n[[description]]";this.previousScale=1},drawChart:function(){AmCharts.AmPieChart.base.drawChart.call(this);var t=this.chartData;if(AmCharts.ifArray(t)){if(0<this.realWidth&&0<this.realHeight){AmCharts.VML&&(this.startAlpha=1);var i=this.startDuration,e=this.container,a=this.updateWidth();this.realWidth=a;var h=this.updateHeight();this.realHeight=h;var s=AmCharts.toCoordinate,r=s(this.marginLeft,a),l=s(this.marginRight,a),n=s(this.marginTop,h)+this.getTitleHeight(),d=s(this.marginBottom,h),o,u,p,c=AmCharts.toNumber(this.labelRadius),g=this.measureMaxLabel();this.labelText&&this.labelsEnabled||(c=g=0);o=void 0===this.pieX?(a-r-l)/2+r:s(this.pieX,this.realWidth);u=void 0===this.pieY?(h-n-d)/2+n:s(this.pieY,h);p=s(this.radius,a,h);p||(a=0<=c?a-r-l-2*g:a-r-l,h=h-n-d,p=Math.min(a,h),h<a&&(p/=1-this.angle/90,p>a&&(p=a)),h=AmCharts.toCoordinate(this.pullOutRadius,p),p=(0<=c?p-1.8*(c+h):p-1.8*h)/2);p<this.minRadius&&(p=this.minRadius);h=s(this.pullOutRadius,p);n=AmCharts.toCoordinate(this.startRadius,p);s=s(this.innerRadius,p);s>=p&&(s=p-1);d=AmCharts.fitToBounds(this.startAngle,0,360);0<this.depth3D&&(d=270<=d?270:90);d-=90;a=p-p*this.angle/90;for(r=0;r<t.length;r++)if(l=t[r],!0!==l.hidden&&0<l.percents){var b=360*l.percents/100,g=Math.sin((d+b/2)/180*Math.PI),m=-Math.cos((d+b/2)/180*Math.PI)*(a/p),C={fill:l.color,stroke:this.outlineColor,"stroke-width":this.outlineThickness,"stroke-opacity":this.outlineAlpha};l.url&&(C.cursor="pointer");C=AmCharts.wedge(e,o,u,d,b,p,a,s,this.depth3D,C,this.gradientRatio);this.addEventListeners(C,l);l.startAngle=d;t[r].wedge=C;if(0<i){var f=this.startAlpha;this.chartCreated&&(f=l.alpha);C.setAttr("opacity",f)}l.ix=g;l.iy=m;l.wedge=C;l.index=r;if(this.labelsEnabled&&this.labelText&&l.percents>=this.hideLabelsPercent){var v=d+b/2,b=c;isNaN(l.labelRadius)||(b=l.labelRadius);var f=o+g*(p+b),A=u+m*(p+b),R,x=0;if(0<=b){var k;90>=v&&0<=v?(k=0,R="start",x=8):90<=v&&180>v?(k=1,R="start",x=8):180<=v&&270>v?(k=2,R="end",x=-8):270<=v&&360>v&&(k=3,R="end",x=-8);l.labelQuarter=k}else R="middle";var v=this.formatString(this.labelText,l),y=l.labelColor;y||(y=this.color);v=AmCharts.text(e,v,y,this.fontFamily,this.fontSize,R);v.translate(f+1.5*x,A);l.tx=f+1.5*x;l.ty=A;l.startX=Math.round(g*n);l.startY=Math.round(m*n);l.pullX=Math.round(g*h);l.pullY=Math.round(m*h);A=s+(p-s)/2;l.pulled&&(A+=this.pullOutRadiusReal);l.balloonX=g*A+o;l.balloonY=m*A+u;0<=b?C.push(v):this.freeLabelsSet.push(v);l.label=v;l.tx=f;l.tx2=f+x;l.tx0=o+g*p;l.ty0=u+m*p}this.graphsSet.push(C);(0===l.alpha||0<i&&!this.chartCreated)&&C.hide();d+=360*l.percents/100}0<c&&!this.labelRadiusField&&this.arrangeLabels();this.pieXReal=o;this.pieYReal=u;this.radiusReal=p;this.innerRadiusReal=s;0<c&&this.drawTicks();this.initialStart();this.setDepths()}(t=this.legend)&&t.invalidateSize()}else this.cleanChart();this.dispDUpd();this.chartCreated=!0},setDepths:function(){var t=this.chartData,i;for(i=0;i<t.length;i++){var e=t[i],a=e.wedge,e=e.startAngle;0<=e&&180>e?a.toFront():180<=e&&a.toBack()}},arrangeLabels:function(){var t=this.chartData,i=t.length,e,a;for(a=i-1;0<=a;a--)e=t[a],0!==e.labelQuarter||e.hidden||this.checkOverlapping(a,e,0,!0,0);for(a=0;a<i;a++)e=t[a],1!=e.labelQuarter||e.hidden||this.checkOverlapping(a,e,1,!1,0);for(a=i-1;0<=a;a--)e=t[a],2!=e.labelQuarter||e.hidden||this.checkOverlapping(a,e,2,!0,0);for(a=0;a<i;a++)e=t[a],3!=e.labelQuarter||e.hidden||this.checkOverlapping(a,e,3,!1,0)},checkOverlapping:function(t,i,e,a,h){var s,r,l=this.chartData,n=l.length,d=i.label;if(d){if(!0===a)for(r=t+1;r<n;r++)l[r].labelQuarter==e&&(s=this.checkOverlappingReal(i,l[r],e))&&(r=n);else for(r=t-1;0<=r;r--)l[r].labelQuarter==e&&(s=this.checkOverlappingReal(i,l[r],e))&&(r=0);!0===s&&100>h&&(s=i.ty+3*i.iy,i.ty=s,d.translate(i.tx2,s),this.checkOverlapping(t,i,e,a,h+1))}},checkOverlappingReal:function(t,i,e){var a=!1,h=t.label,s=i.label;t.labelQuarter!=e||t.hidden||i.hidden||!s||(h=h.getBBox(),e={},e.width=h.width,e.height=h.height,e.y=t.ty,e.x=t.tx,t=s.getBBox(),s={},s.width=t.width,s.height=t.height,s.y=i.ty,s.x=i.tx,AmCharts.hitTest(e,s)&&(a=!0));return a}});
//# sourceMappingURL=pie.map.js